From: kaf24@firebug.cl.cam.ac.uk Date: Mon, 3 Jul 2006 07:57:15 +0000 (+0100) Subject: [NET] back: Fix off-by-one error in netbk_tx_err X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~15908 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=3de1ac2405d668a2ade90c20ae44a37ea1c66fac;p=xen.git [NET] back: Fix off-by-one error in netbk_tx_err The generalised extra request info patch introduced a bug with the use of netbk_tx_err since it advanced the req_cons pointer by one. This patch fixes thing by delaying the increment in netbk_tx_err. Signed-off-by: Herbert Xu --- diff --git a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c index 93e39612bc..5171d0ab02 100644 --- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c +++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c @@ -496,9 +496,9 @@ static void netbk_tx_err(netif_t *netif, netif_tx_request_t *txp, RING_IDX end) do { make_tx_response(netif, txp, NETIF_RSP_ERROR); - if (++cons >= end) + if (cons >= end) break; - txp = RING_GET_REQUEST(&netif->tx, cons); + txp = RING_GET_REQUEST(&netif->tx, cons++); } while (1); netif->tx.req_cons = cons; netif_schedule_work(netif); @@ -764,11 +764,11 @@ static void net_tx_action(unsigned long unused) if (txreq.flags & NETTXF_extra_info) { work_to_do = netbk_get_extras(netif, extras, work_to_do); + i = netif->tx.req_cons; if (unlikely(work_to_do < 0)) { - netbk_tx_err(netif, &txreq, 0); + netbk_tx_err(netif, &txreq, i); continue; } - i = netif->tx.req_cons; } ret = netbk_count_requests(netif, &txreq, work_to_do);